package demo01extends;

/*
* 把数组{1,2,3}拼接成字符串[word1#word2#word3]
* */
public class Demo05StringPractice {
    public static void main(String[] args) {
        int[] arr={1,2,3};
        String result=fromArrToString(arr);
        System.out.println(result);
    }
    public static String fromArrToString(int arr[]){
        String result="[";
        for (int i = 0; i < arr.length; i++) {
            if(i<arr.length-1){
                result+="word"+arr[i]+"#";
            }
            else
                result+="word"+arr[i]+"]";
        }
        return result;
    }
}
